import src.utils.CountUtil;

public class WordCount {
    public static void main(String[] args) {
        String filePath = "";
        String flag = "";
        for (int i = 0; i < args.length; i++) {
            if (args[i].startsWith("-")) {
                char c = args[i].charAt(1);
                if (c != 'c' && c != 'w') System.out.println("error");
                flag = args[i];
            } else filePath = args[i];
        }

        String result = null;

        if (flag.equals("-c")) {
            result = CountUtil.Characters(filePath);
        } else if (flag.equals("-w")) {
            result = CountUtil.Words(filePath);
        }

        System.out.println(result);
    }
}
